#!/bin/bash
# 安装编译环境
# 该脚本只能在当前文件夹下执行

RUN_FOLDER=.
[ -d ./bash ] && RUN_FOLDER=bash

# 导入常量定义
. $RUN_FOLDER/constant

. $RUN_FOLDER/common_functions.sh

if [ "$(uname -o)" = 'GNU/Linux' ]
then
    # 获取发行版本(ubuntu,centos...)
    [ -f /etc/os-release ] || exit_on_error "ERROR:NOT FOUND /etc/os-release"
    eval dist_id=$(get_value /etc/os-release ID)
    . $RUN_FOLDER/native_functions_${dist_id,,}.sh || exit_on_error "不支持当前平台:$dist_id"
    install_base_utils
fi

# 安装的目标文件夹
PREFIX=$HOME
[ "$(uname -o)" = 'Msys' ] && PREFIX=$RUN_FOLDER/$DEP_FOLDER
PKG_FOLDER=$RUN_FOLDER/$PKG_FOLDER

install_build_tools_if_needed 
